// 引入jQuery的CDN
import 'https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js';
class Datail {
    constructor() {

    }

    init() {
        this.xingqy();
    }


    xingqy() {

        let sid = location.search.substring(1).split('=')[1]
        if (!sid) {
            sid = 1;
        }

        // console.log(sid);
        // http://localhost/www.gome.com.cn/interface/detail.php


        $.ajax({
            url: 'http://localhost/www.gome.com.cn/zkl/interface/detail.php',
            data: {
                sid: sid
            },
            dataType: 'json'
        }).then(function(res) {
            $('.left-sp  .scale img').attr('src', res.url);
            $('.right-js h1').html(res.title);
            $('.right-js>div>p>.jjj').html(res.price);
            let arr = res.piclist.split(',');
            let sty = '';
            $.each(arr, function(i, v) {
                sty += `
                <li>
                    <a href="">
                        <img src= ${v} alt="">
                    </a>
                </li>
                       `
            })

            $('.commodity-wuping .small ul').html(sty)
        })

    }

}
export {
    Datail
}